<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
</head>
<body>
    <div id="wrap">
        <div id="main">

        </div>
    </div>
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/main.js"></script>
<script type="text/javascript">
  apiready = function(){
      api.setStatusBarStyle({
        style: 'light'
      });
		//frame的高度为当前window高度
		var frameH = api.winHeight;
    var jwt=$api.getStorage('jwt');
        //如果有jwt就直接进入首页，没有就跳转到登录页面
        if(jwt==undefined||jwt==""){
          //弹出登录页面
          api.openFrame({
              name: 'login',
              url: 'html/login.html',
              scrollEnabled:false,
              rect: {
                  x: 0,
                  y: 0,
                  w: 'auto',
                  h: 'auto'
              }
          });
        }else{
        //如果token不为0
          api.openFrame({
              name: 'main',
              url: 'html/main.html',
              bounces: false,
              rect: {
                  x: 0,
                  y: 0,
                  w: 'auto',
                  h: frameH
              }
          });
        }
    };
</script>
</html>
